import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

// /* Router Modules */
// import componentsRouter from './modules/components'
// import chartsRouter from './modules/charts'
// import tableRouter from './modules/table'
// import nestedRouter from './modules/nested'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'/'el-icon-x' the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */
export const constantRoutes = [
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect/index')
      }
    ]
  },
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  // {
  //   path: '/permission',
  //   component: Layout,
  //   redirect: '/permission/page',
  //   alwaysShow: true, // will always show the root menu
  //   name: 'Permission',
  //   meta: {
  //     title: 'Permission',
  //     icon: 'lock',
  //     roles: ['admin', 'editor'] // you can set roles in root nav
  //   },
  //   children: [
  //     {
  //       path: 'page',
  //       component: () => import('@/views/permission/page'),
  //       name: 'PagePermission',
  //       meta: {
  //         title: 'Page Permission',
  //         roles: ['admin'] // or you can only set roles in sub nav
  //       }
  //     },
  //     {
  //       path: 'directive',
  //       component: () => import('@/views/permission/directive'),
  //       name: 'DirectivePermission',
  //       meta: {
  //         title: 'Directive Permission'
  //         // if do not set roles, means: this page does not require permission
  //       }
  //     },
  //     {
  //       path: 'role',
  //       component: () => import('@/views/permission/role'),
  //       name: 'RolePermission',
  //       meta: {
  //         title: 'Role Permission',
  //         roles: ['admin']
  //       }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/icon',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/icons/index'),
  //       name: 'Icons',
  //       meta: { title: 'Icons', icon: 'icon', noCache: true }
  //     }
  //   ]
  // },
  //
  // /** when your routing map is too long, you can split it into small modules **/
  // componentsRouter,
  // chartsRouter,
  // nestedRouter,
  // tableRouter,
  //
  // {
  //   path: '/example',
  //   component: Layout,
  //   redirect: '/example/list',
  //   name: 'Example',
  //   meta: {
  //     title: 'Example',
  //     icon: 'el-icon-s-help'
  //   },
  //   children: [
  //     {
  //       path: 'create',
  //       component: () => import('@/views/example/create'),
  //       name: 'CreateArticle',
  //       meta: { title: 'Create Article', icon: 'edit' }
  //     },
  //     {
  //       path: 'edit/:id(\\d+)',
  //       component: () => import('@/views/example/edit'),
  //       name: 'EditArticle',
  //       meta: { title: 'Edit Article', noCache: true, activeMenu: '/example/list' },
  //       hidden: true
  //     },
  //     {
  //       path: 'list',
  //       component: () => import('@/views/example/list'),
  //       name: 'ArticleList',
  //       meta: { title: 'Article List', icon: 'list' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/tab',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/tab/index'),
  //       name: 'Tab',
  //       meta: { title: 'Tab', icon: 'tab' }
  //     }
  //   ]
  // },

  // {
  //   path: '/error',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'ErrorPages',
  //   meta: {
  //     title: 'Error Pages',
  //     icon: '404'
  //   },
  //   children: [
  //     {
  //       path: '401',
  //       component: () => import('@/views/error-page/401'),
  //       name: 'Page401',
  //       meta: { title: '401', noCache: true }
  //     },
  //     {
  //       path: '404',
  //       component: () => import('@/views/error-page/404'),
  //       name: 'Page404',
  //       meta: { title: '404', noCache: true }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/error-log',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'log',
  //       component: () => import('@/views/error-log/index'),
  //       name: 'ErrorLog',
  //       meta: { title: 'Error Log', icon: 'bug' }
  //     }
  //   ]
  // },

  // {
  //   path: '/excel',
  //   component: Layout,
  //   redirect: '/excel/export-excel',
  //   name: 'Excel',
  //   meta: {
  //     title: 'Excel',
  //     icon: 'excel'
  //   },
  //   children: [
  //     {
  //       path: 'export-excel',
  //       component: () => import('@/views/excel/export-excel'),
  //       name: 'ExportExcel',
  //       meta: { title: 'Export Excel' }
  //     },
  //     {
  //       path: 'export-selected-excel',
  //       component: () => import('@/views/excel/select-excel'),
  //       name: 'SelectExcel',
  //       meta: { title: 'Export Selected' }
  //     },
  //     {
  //       path: 'export-merge-header',
  //       component: () => import('@/views/excel/merge-header'),
  //       name: 'MergeHeader',
  //       meta: { title: 'Merge Header' }
  //     },
  //     {
  //       path: 'upload-excel',
  //       component: () => import('@/views/excel/upload-excel'),
  //       name: 'UploadExcel',
  //       meta: { title: 'Upload Excel' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/zip',
  //   component: Layout,
  //   redirect: '/zip/download',
  //   alwaysShow: true,
  //   name: 'Zip',
  //   meta: { title: 'Zip', icon: 'zip' },
  //   children: [
  //     {
  //       path: 'download',
  //       component: () => import('@/views/zip/index'),
  //       name: 'ExportZip',
  //       meta: { title: 'Export Zip' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/pdf',
  //   component: Layout,
  //   redirect: '/pdf/index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/pdf/index'),
  //       name: 'PDF',
  //       meta: { title: 'PDF', icon: 'pdf' }
  //     }
  //   ]
  // },
  // {
  //   path: '/pdf/download',
  //   component: () => import('@/views/pdf/download'),
  //   hidden: true
  // },
  //
  // {
  //   path: '/theme',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/theme/index'),
  //       name: 'Theme',
  //       meta: { title: 'Theme', icon: 'theme' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: '/clipboard',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/clipboard/index'),
  //       name: 'ClipboardDemo',
  //       meta: { title: 'Clipboard', icon: 'clipboard' }
  //     }
  //   ]
  // },
  //
  // {
  //   path: 'external-link',
  //   component: Layout,
  //   children: [
  //     {
  //       path: 'https://github.com/PanJiaChen/vue-element-admin',
  //       meta: { title: 'External Link', icon: 'link' }
  //     }
  //   ]
  // }
  {
    path: '/',
    component: Layout,
    redirect: '/index',
    children: [
      {
        path: 'baobiao',
        component: () => import('@/views/dashboard/chats'),
        hidden: true,
        name: 'baobiao',
        meta: { title: '驾驶舱', icon: 'dashboard', affix: true }
      }
    ]
  },
  {
    path: '/index',
    component: Layout,
    redirect: '/index/index',
    name: '首页',
    meta: {
      title: 'home',
      icon: 'index',
      i18: 'dashboard'
    },
    children: [
      // {
      //   path: 'index',
      //   component: () => import('@/views/index/index'),
      //   name: 'index',
      //   hidden: true,
      //   meta: { title: '系统首页', icon: 'dashboard', noCache: true, i18: 'dashboard' }
      // },
      {
        path: 'index',
        component: () => import('@/views/index/chart'),
        name: 'chat',
        meta: { title: '首页', icon: 'dashboard', noCache: true, i18: 'dashboard' }
      }
    ]
  },
  {
    path: '/energy',
    component: Layout,
    redirect: 'noRedirect',
    name: 'energys',
    meta: {
      title: 'Energy',
      icon: 'zichan',
      roles: ['energyBoard']
    },
    children: [
      {
        path: 'energy',
        component: () => import('@/views/energyPage/index'),
        name: 'energy',
        meta: { title: '能源报表', noCache: true, i18: '能源报表', roles: ['energyBoard'] }
      },
      {
        path: 'nengyuan',
        component: () => import('@/views/dashboard/energy'),
        name: 'nengyuan',
        hidden: true,
        meta: { title: '能源报表', noCache: true, i18: '能源报表' }
      }
    ]
  },
  {
    path: '/asset',
    component: Layout,
    redirect: 'noRedirect',
    name: 'asset',
    alwaysShow: true,
    meta: {
      title: 'Asset',
      icon: 'zichan',
      roles: ['Asset'],
      i18: 'asset.name'
    },
    children: [
      {
        path: 'equipment',
        component: () => import('@/views/assetPage/equipment/index'),
        name: 'equipment',
        meta: { title: '设备台账', noCache: true, roles: ['AssetEquipment'], i18: 'asset.equipment.list' }
      },
      {
        path: '/equipment/add',
        component: () => import('@/views/assetPage/equipment/detail'),
        name: 'equipmentAdd',
        hidden: true,
        meta: { title: '设备新增', activeMenu: '/asset/equipment', roles: ['AssetEquipmentAdd'], i18: 'asset.equipment.create' }
      },
      {
        path: '/equipment/edit/:id',
        component: () => import('@/views/assetPage/equipment/detail'),
        hidden: true,
        name: 'equipmentEdit',
        meta: { title: '设备详情', activeMenu: '/asset/equipment', roles: ['AssetEquipmentDetail'], i18: 'asset.equipment.edit' }
      },
      {
        path: 'jig',
        component: () => import('@/views/assetPage/jig/index'),
        name: 'jig',
        meta: { title: '工装台账', noCache: true, roles: ['AssetJig'], i18: 'asset.jig.list' }
      },
      {
        path: '/jig/add',
        component: () => import('@/views/assetPage/jig/detail'),
        name: 'jigAdd',
        hidden: true,
        meta: { title: '工装新增', activeMenu: '/asset/jig', roles: ['AssetJigEdit'], i18: 'asset.jig.create' }
      },
      {
        path: '/jig/edit/:id',
        component: () => import('@/views/assetPage/jig/detail'),
        hidden: true,
        name: 'jigEdit',
        meta: { title: '工装详情', activeMenu: '/asset/jig', roles: ['AssetJigDetail'], i18: 'asset.jig.edit' }
      },
      {
        path: 'facility',
        component: () => import('@/views/assetPage/facility/index'),
        name: 'facility',
        meta: { title: '设施台账', noCache: true, roles: ['AssetFacility'], i18: 'asset.facility.list' }
      },
      {
        path: '/facility/add',
        component: () => import('@/views/assetPage/facility/detail'),
        name: 'facilityAdd',
        hidden: true,
        meta: { title: '设施新增', activeMenu: '/asset/facility', roles: ['AssetFacilityEdit'], i18: 'asset.facility.create' }
      },
      {
        path: '/facility/edit/:id',
        component: () => import('@/views/assetPage/facility/detail'),
        hidden: true,
        name: 'facilityEdit',
        meta: { title: '设施详情', activeMenu: '/asset/facility', roles: ['AssetFacilityDetail'], i18: 'asset.facility.edit' }
      },
      {
        path: 'equipmentCategory',
        component: () => import('@/views/assetPage/eqCategory/index'),
        name: 'eqCategory',
        meta: { title: '设备分类', noCache: true, roles: ['AssetEquipmentCategory'], i18: 'asset.category.list' }
      },
      {
        path: '/equipmentCategory/add',
        component: () => import('@/views/assetPage/eqCategory/detail'),
        name: 'eqCategoryAdd',
        hidden: true,
        meta: { title: '新增设备分类', activeMenu: '/asset/equipmentCategory', roles: ['AssetEquipmentCategoryAdd'], i18: 'asset.category.create' }
      },
      {
        path: '/equipmentCategory/edit/:id',
        component: () => import('@/views/assetPage/eqCategory/detail'),
        hidden: true,
        name: 'eqCategoryEdit',
        meta: { title: '设备分类详情', activeMenu: '/asset/equipmentCategory', roles: ['AssetEquipmentCategoryDetail'], i18: 'asset.category.edit' }
      }
    ]
  },
  {
    path: '/stock',
    component: Layout,
    redirect: 'noRedirect',
    alwaysShow: true,
    name: 'stock',
    meta: {
      title: '备件管理',
      icon: 'beijian',
      roles: ['Stock'],
      i18: 'stock.name'
    },
    children: [
      {
        path: '/stock/parts',
        component: () => import('@/views/stockPage/parts/index'),
        name: 'parts',
        meta: { title: '备件台账', noCache: true, roles: ['StockParts'], i18: 'stock.spares.list' }
      },
      {
        path: '/parts/add',
        component: () => import('@/views/stockPage/parts/detail'),
        name: 'partsAdd',
        hidden: true,
        meta: { title: '备件新增', activeMenu: '/stock/parts', roles: ['StockPartsAdd'], i18: 'stock.spares.create' }
      },
      {
        path: '/parts/edit/:id',
        component: () => import('@/views/stockPage/parts/detail'),
        hidden: true,
        name: 'partsEdit',
        meta: { title: '备件详情', activeMenu: '/stock/parts', roles: ['StockPartsDetail'], i18: 'stock.spares.edit' }
      },
      {
        path: '/stock/partsCategory',
        component: () => import('@/views/stockPage/partsCategory/index'),
        name: 'partsCategory',
        meta: { title: '备件分类', noCache: true, roles: ['StockPartsCategory'], i18: 'stock.category.list' }
      },
      {
        path: '/partsCategory/add',
        component: () => import('@/views/stockPage/partsCategory/detail'),
        name: 'partsCategoryAdd',
        hidden: true,
        meta: { title: '备件分类新增', activeMenu: '/stock/partsCategory', roles: ['StockPartsCategoryAdd'], i18: 'stock.category.create' }
      },
      {
        path: '/partsCategory/edit/:id',
        component: () => import('@/views/stockPage/partsCategory/detail'),
        hidden: true,
        name: 'partsCategoryEdit',
        meta: { title: '备件分类详情', activeMenu: '/stock/partsCategory', roles: ['StockPartsCategoryDetail'], i18: 'stock.category.edit' }
      },
      {
        path: '/stock/enter',
        component: () => import('@/views/stockPage/stockEnter/index'),
        name: 'enter',
        meta: { title: '收货入库', noCache: true, roles: ['StockEnter'], i18: 'stock.enter.list' }
      },
      {
        path: '/stock/enter/add',
        component: () => import('@/views/stockPage/stockEnter/detail'),
        name: 'enterAdd',
        hidden: true,
        meta: { title: '入库新增', activeMenu: '/stock/enter', roles: ['StockEnterAdd'], i18: 'stock.enter.create' }
      },
      {
        path: '/stock/enter/edit/:id',
        component: () => import('@/views/stockPage/stockEnter/detail'),
        hidden: true,
        name: 'enterEdit',
        meta: { title: '入库详情', activeMenu: '/stock/enter', roles: ['StockEnterDetail'], i18: 'stock.enter.detail' }
      },
      {
        path: '/stock/appear',
        component: () => import('@/views/stockPage/stockAppear/index'),
        name: 'appear',
        meta: { title: '领取出库', noCache: true, roles: ['StockAppear'], i18: 'stock.appear.list' }
      },
      {
        path: '/stock/appear/add',
        component: () => import('@/views/stockPage/stockAppear/detail'),
        name: 'appearAdd',
        hidden: true,
        meta: { title: '出库新增', activeMenu: '/stock/appear', roles: ['StockAppearAdd'], i18: 'stock.appear.create' }
      },
      {
        path: '/stock/appear/edit/:id',
        component: () => import('@/views/stockPage/stockAppear/detail'),
        hidden: true,
        name: 'appearEdit',
        meta: { title: '出库详情', activeMenu: '/stock/appear', roles: ['StockAppearDetail'], i18: 'stock.appear.detail' }
      },
      {
        path: '/stock/apply',
        component: () => import('@/views/stockPage/apply/index'),
        name: 'stockApply',
        meta: { title: '补库请求', noCache: true, roles: ['StockApply'], i18: 'stock.apply.list' }
      },
      {
        path: '/stock/apply/edit/:id',
        component: () => import('@/views/stockPage/apply/detail'),
        hidden: true,
        name: 'stockApplyEdit',
        meta: { title: '补库请求详情', activeMenu: '/stock/apply', roles: ['StockApplyDetail'], i18: 'stock.apply.detail' }
      },
      {
        path: '/stock/take',
        component: () => import('@/views/stockPage/stockTake/index'),
        name: 'stockTake',
        meta: { title: '库存盘点', noCache: true, roles: ['StockTake'], i18: 'stock.take.list' }
      },
      {
        path: '/stock/take/add',
        component: () => import('@/views/stockPage/stockTake/detail'),
        name: 'stockTakeAdd',
        hidden: true,
        meta: { title: '库存盘点新增', activeMenu: '/stock/take', roles: ['StockTakeAdd'], i18: 'stock.take.create' }
      },
      {
        path: '/stock/take/edit/:id',
        component: () => import('@/views/stockPage/stockTake/detail'),
        hidden: true,
        name: 'stockTakeEdit',
        meta: { title: '库存盘点详情', activeMenu: '/stock/take', roles: ['StockTakeDetail'], i18: 'stock.take.detail' }
      },
      {
        path: 'stock/book',
        component: { render: (e) => e('router-view') },
        name: 'books',
        meta: { title: '明细查询', noCache: true, i18: 'stock.book.name', roles: ['partsAppearEnter'] },
        children: [
          {
            path: '/stock/book/appearBook1',
            component: () => import('@/views/stockPage/stockAppear/book'),
            name: 'bookAppear',
            hidden: true,
            meta: { title: '出库明细', activeMenu: 'stock/book/appearBook1', roles: ['StockBookAppear'] }
          },
          {
            path: '/stock/book/appearBook',
            component: () => import('@/views/stockPage/stockAppear/book'),
            name: 'stockBookAppear',
            meta: { title: '出库明细', activeMenu: '/stock/book/appearBook', i18: 'stock.book.appear', roles: ['StockBookAppear'] }
          },
          {
            path: '/stock/book/enterBook',
            component: () => import('@/views/stockPage/stockEnter/book'),
            name: 'bookEnter',
            meta: { title: '入库明细', activeMenu: '/stock/book/enterBook', i18: 'stock.book.enter', roles: ['StockBookEnter'] }
          }
        ]
      }
    ]
  },
  {
    path: '/tools',
    component: Layout,
    redirect: 'noRedirect',
    name: 'tool',
    alwaysShow: true,
    meta: {
      title: '工具管理',
      icon: 'gongju',
      roles: ['Tool'],
      i18: 'tool.name'
    },
    children: [
      {
        path: '/tool/tools',
        component: () => import('@/views/toolPage/tools/index'),
        name: 'tools',
        meta: { title: '工具台账', noCache: true, roles: ['ToolTools'], i18: 'tool.tools.list' }
      },
      {
        path: '/tool/tools/add',
        component: () => import('@/views/toolPage/tools/detail'),
        name: 'toolAdd',
        hidden: true,
        meta: { title: '工具新增', activeMenu: '/tool/tools', roles: ['ToolToolsAdd'], i18: 'tool.tools.create' }
      },
      {
        path: '/tool/tools/edit/:id',
        component: () => import('@/views/toolPage/tools/detail'),
        hidden: true,
        name: 'toolEdit',
        meta: { title: '工具详情', activeMenu: '/tool/tools', roles: ['ToolToolsDetail'], i18: 'tool.tools.edit' }
      },
      {
        path: '/tool/category',
        component: () => import('@/views/toolPage/toolCategory/index'),
        name: 'toolCategory',
        meta: { title: '工具分类', noCache: true, roles: ['ToolCategory'], i18: 'tool.category.list' }
      },
      {
        path: '/tool/category/add',
        component: () => import('@/views/toolPage/toolCategory/detail'),
        name: 'toolCategoryAdd',
        hidden: true,
        meta: { title: '工具分类新增', activeMenu: '/tool/category', roles: ['ToolCategoryAdd'], i18: 'tool.category.create' }
      },
      {
        path: '/tool/category/edit/:id',
        component: () => import('@/views/toolPage/toolCategory/detail'),
        hidden: true,
        name: 'toolCategoryEdit',
        meta: { title: '工具分类详情', activeMenu: '/tool/category', roles: ['ToolCategoryDetail'], i18: 'tool.category.edit' }
      },
      {
        path: '/tool/enter',
        component: () => import('@/views/toolPage/toolEnter/index'),
        name: 'toolsEnter',
        meta: { title: '工具入库', noCache: true, roles: ['ToolEnter'], i18: 'tool.enter.list' }
      },
      {
        path: '/tool/enter/add',
        component: () => import('@/views/toolPage/toolEnter/detail'),
        name: 'toolEnterAdd',
        hidden: true,
        meta: { title: '工具入库新增', activeMenu: '/tool/enter', roles: ['ToolEnterAdd'], i18: 'tool.enter.create' }
      },
      {
        path: '/tool/enter/edit/:id',
        component: () => import('@/views/toolPage/toolEnter/detail'),
        hidden: true,
        name: 'toolEnterEdit',
        meta: { title: '工具入库详情', activeMenu: '/tool/enter', roles: ['ToolEnterDetail'], i18: 'tool.enter.detail' }
      },
      {
        path: '/tool/appear',
        component: () => import('@/views/toolPage/toolAppear/index'),
        name: 'toolAppear',
        meta: { title: '工具出库', noCache: true, roles: ['ToolAppear'], i18: 'tool.appear.list' }
      },
      {
        path: '/tool/appear/add',
        component: () => import('@/views/toolPage/toolAppear/detail'),
        name: 'toolAppearAdd',
        hidden: true,
        meta: { title: '工具出库新增', activeMenu: '/tool/appear', roles: ['ToolAppearAdd'], i18: 'tool.appear.create' }
      },
      {
        path: '/tool/appear/edit/:id',
        component: () => import('@/views/toolPage/toolAppear/detail'),
        hidden: true,
        name: 'toolAppearEdit',
        meta: { title: '工具出库详情', activeMenu: '/tool/appear', roles: ['ToolAppearDetail'], i18: 'tool.appear.detail' }
      },
      {
        path: '/tool/take',
        component: () => import('@/views/toolPage/toolTake/index'),
        name: 'toolTake',
        meta: { title: '工具盘点', noCache: true, roles: ['ToolTake'], i18: 'tool.take.list' }
      },
      {
        path: '/tool/take/add',
        component: () => import('@/views/toolPage/toolTake/detail'),
        name: 'toolTakeAdd',
        hidden: true,
        meta: { title: '工具盘点新增', activeMenu: '/tool/take', roles: ['ToolTakeAdd'], i18: 'tool.take.create' }
      },
      {
        path: '/tool/take/edit/:id',
        component: () => import('@/views/toolPage/toolTake/detail'),
        hidden: true,
        name: 'toolTakeEdit',
        meta: { title: '工具盘点详情', activeMenu: '/tool/take', roles: ['ToolTakeDetail'], i18: 'tool.take.detail' }
      },
      {
        path: '/tool/book',
        component: { render: (e) => e('router-view') },
        name: 'toolBook',
        meta: { title: '明细查询', noCache: true, roles: ['toolAppearEnter'], i18: 'tool.book.name' },
        children: [
          {
            path: '/tool/book/appear',
            component: () => import('@/views/toolPage/toolAppear/book'),
            name: 'toolBookAppear1',
            hidden: true,
            meta: { title: '出库明细', activeMenu: 'tool/book/appear', roles: ['toolAppearEnter'] }
          },
          {
            path: '/tool/book/appearBook',
            component: () => import('@/views/toolPage/toolAppear/book'),
            name: 'toolBookAppear',
            meta: { title: '出库明细', activeMenu: '/tool/book/appearBook', i18: 'tool.book.appear', roles: ['ToolBookAppear'] }
          },
          {
            path: '/tool/book/enterBook',
            component: () => import('@/views/toolPage/toolEnter/book'),
            name: 'toolBookEnter',
            meta: { title: '入库明细', activeMenu: '/tool/book/enterBook', i18: 'tool.book.enter', roles: ['ToolBookEnter'] }
          }

        ]
      }
    ]
  },
  {
    path: '/project',
    component: Layout,
    redirect: 'noRedirect',
    name: 'projects',
    alwaysShow: true,
    meta: {
      title: '维护管理',
      icon: 'weihu',
      roles: ['Project'],
      i18: 'project.name'
    },
    children: [
      {
        path: '/project/plans',
        component: { render: (e) => e('router-view') },
        name: 'plan',
        meta: { title: '维护计划', noCache: true, roles: ['ProjectPlan'], i18: 'project.plan.name' },
        children: [
          {
            path: '/project/plan1',
            component: () => import('@/views/projectPage/plan1/index'),
            name: 'plan1',
            meta: { title: '自主点检', activeMenu: '/project/plan1', roles: ['ProjectPlan1'], i18: 'project.plan.plan1.list' }
          },
          {
            path: '/project/plan5',
            component: () => import('@/views/projectPage/plan5/index'),
            name: 'plan5',
            meta: { title: '专业点检', activeMenu: '/project/plan5', roles: ['ProjectPlan5'], i18: 'project.plan.plan5.list' }
          },
          {
            path: '/project/plan2',
            component: () => import('@/views/projectPage/plan2/index'),
            name: 'plan2',
            meta: { title: '自主维护', activeMenu: '/project/plan2', roles: ['ProjectPlan2'], i18: 'project.plan.plan2.list' }
          },
          {
            path: '/project/plan3',
            component: () => import('@/views/projectPage/plan3/index'),
            name: 'plan3',
            meta: { title: '专业维护', activeMenu: '/project/plan3', roles: ['ProjectPlan3'], i18: 'project.plan.plan3.list' }
          },
          {
            path: '/project/plan4',
            component: () => import('@/views/projectPage/plan4/index'),
            name: 'plan4',
            meta: { title: '加油润滑', activeMenu: '/project/plan4', roles: ['ProjectPlan4'], i18: 'project.plan.plan4.list' }
          },
          {
            path: '/project/plan6',
            component: () => import('@/views/projectPage/plan6/index'),
            name: 'plan6',
            meta: { title: '专业巡检', activeMenu: '/project/plan6', roles: ['ProjectPlan6'], i18: 'project.plan.plan6.list' }
          },
          {
            path: '/project/plan1/edit/:id',
            component: () => import('@/views/projectPage/plan1/detail'),
            name: 'plan1Edit',
            hidden: true,
            meta: { title: '自主点检详情', activeMenu: '/project/plan1', roles: ['ProjectPlan1Detail'], i18: 'project.plan.detail' }
          },
          {
            path: '/project/plan1/add',
            component: () => import('@/views/projectPage/plan1/detail'),
            name: 'plan1Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/project/plan1', roles: ['ProjectPlan3Add'], i18: 'project.plan.create' }
          },
          {
            path: '/project/plan2/edit/:id',
            component: () => import('@/views/projectPage/plan2/detail'),
            name: 'plan2Edit',
            hidden: true,
            meta: { title: '自主维护详情', activeMenu: '/project/plan2', roles: ['ProjectPlan2Detail'], i18: 'project.plan.detail' }
          },
          {
            path: '/project/plan2/add',
            component: () => import('@/views/projectPage/plan2/detail'),
            name: 'plan2Add',
            hidden: true,
            meta: { title: '自主维护新增', activeMenu: '/project/plan2', roles: ['ProjectPlan2Add'], i18: 'project.plan.create' }
          },
          {
            path: '/project/plan3/edit/:id',
            component: () => import('@/views/projectPage/plan3/detail'),
            name: 'plan3Edit',
            hidden: true,
            meta: { title: '专业维护详情', activeMenu: '/project/plan3', roles: ['ProjectPlan3Detail'], i18: 'project.plan.detail' }
          },
          {
            path: '/project/plan3/add',
            component: () => import('@/views/projectPage/plan3/detail'),
            name: 'plan3Add',
            hidden: true,
            meta: { title: '专业维护新增', activeMenu: '/project/plan3', roles: ['ProjectPlan3Add'], i18: 'project.plan.create' }
          },
          {
            path: '/project/plan4/edit/:id',
            component: () => import('@/views/projectPage/plan4/detail'),
            name: 'plan4Edit',
            hidden: true,
            meta: { title: '加油润滑详情', activeMenu: '/project/plan4', roles: ['ProjectPlan4Detail'], i18: 'project.plan.detail' }
          },
          {
            path: '/project/plan4/add',
            component: () => import('@/views/projectPage/plan4/detail'),
            name: 'plan4Add',
            hidden: true,
            meta: { title: '加油润滑新增', activeMenu: '/project/plan4', roles: ['ProjectPlan4Add'], i18: 'project.plan.create' }
          },

          {
            path: '/project/plan5/edit/:id',
            component: () => import('@/views/projectPage/plan5/detail'),
            name: 'plan5Edit',
            hidden: true,
            meta: { title: '专业点检详情', activeMenu: '/project/plan5', roles: ['ProjectPlan5Detail'], i18: 'project.plan.detail' }
          },
          {
            path: '/project/plan5/add',
            component: () => import('@/views/projectPage/plan5/detail'),
            name: 'plan5Add',
            hidden: true,
            meta: { title: '专业点检新增', activeMenu: '/project/plan5', roles: ['ProjectPlan5Add'], i18: 'project.plan.create' }
          },
          {
            path: '/project/plan6/edit/:id',
            component: () => import('@/views/projectPage/plan6/detail'),
            name: 'plan6Edit',
            hidden: true,
            meta: { title: '专业巡检详情', activeMenu: '/project/plan6', roles: ['ProjectPlan6Detail'], i18: 'project.plan.detail' }
          },
          {
            path: '/project/plan6/add',
            component: () => import('@/views/projectPage/plan6/detail'),
            name: 'plan6Add',
            hidden: true,
            meta: { title: '专业巡检新增', activeMenu: '/project/plan6', roles: ['ProjectPlan6Add'], i18: 'project.plan.create' }
          }
        ]
      },
      {
        path: '/project/task',
        component: () => import('@/views/projectPage/task/index'),
        name: 'task',
        meta: { title: '方法管理', noCache: true, roles: ['ProjectTask'], i18: 'project.task.name' }
      },
      {
        path: '/project/task/add',
        component: () => import('@/views/projectPage/task/detail'),
        name: 'taskAdd',
        hidden: true,
        meta: { title: '方法管理新增', activeMenu: '/project/task', roles: ['ProjectTaskAdd'], i18: 'project.task.create' }
      },
      {
        path: '/project/task/edit/:id',
        component: () => import('@/views/projectPage/task/detail'),
        hidden: true,
        name: 'taskEdit',
        meta: { title: '方法管理详情', activeMenu: '/project/task', roles: ['ProjectTaskDetail'], i18: 'project.task.edit' }
      },
      {
        path: '/project/apply',
        component: () => import('@/views/projectPage/apply/index'),
        name: 'apply',
        meta: { title: '故障报修', noCache: true, roles: ['ProjectApply'], i18: 'project.apply.name' }
      },
      {
        path: '/project/apply/add',
        component: () => import('@/views/projectPage/apply/detail'),
        name: 'applyAdd',
        hidden: true,
        meta: { title: '故障报修新增', activeMenu: '/project/apply', roles: ['ProjectApplyAdd'], i18: 'project.apply.create' }
      },
      {
        path: '/project/apply/edit/:id',
        component: () => import('@/views/projectPage/apply/detail'),
        hidden: true,
        name: 'applyEdit',
        meta: { title: '故障报修详情', activeMenu: '/project/apply', roles: ['ProjectApplyDetail'], i18: 'project.apply.edit' }
      }
    ]
  },
  {
    path: '/workorder',
    component: Layout,
    redirect: 'noRedirect',
    name: 'workorders',
    alwaysShow: true,
    meta: {
      title: '工单管理',
      icon: 'gongdan',
      roles: ['WorkOrder'],
      i18: 'workorder.name'
    },
    children: [
      {
        path: '/workOrder/pm',
        component: { render: (e) => e('router-view') },
        name: 'plans',
        meta: { title: '计划性维护', noCache: true, roles: ['WorkOrderPm'], i18: 'workorder.pm.name' },
        children: [
          {
            path: '/workOrder/pm1',
            component: () => import('@/views/workOrderPage/pm1'),
            name: 'pm1',
            meta: { title: '自主点检', activeMenu: '/workOrder/pm1', roles: ['WorkOrderPm1'], i18: 'workorder.pm.plan1.name' }
          },
          {
            path: '/workOrder/pm1/add',
            component: () => import('@/views/workOrderPage/pm1/detail'),
            name: 'pm1Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/workOrder/pm1', roles: ['WorkOrderPm1Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm1/edit/:id',
            component: () => import('@/views/workOrderPage/pm1/detail'),
            name: 'pm1Edit',
            hidden: true,
            meta: { title: '自主点检详情', activeMenu: '/workOrder/pm1', roles: ['WorkOrderPm1Detail'], i18: 'workorder.detail' }
          },
          {
            path: '/workOrder/pm2',
            component: () => import('@/views/workOrderPage/pm2'),
            name: 'pm2',
            meta: { title: '自主维护', activeMenu: '/workOrder/pm2', roles: ['WorkOrderPm2'], i18: 'workorder.pm.plan2.list' }
          },
          {
            path: '/workOrder/pm2/add',
            component: () => import('@/views/workOrderPage/pm2/detail'),
            name: 'pm2Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/workOrder/pm2', roles: ['WorkOrderPm2Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm2/edit/:id',
            component: () => import('@/views/workOrderPage/pm2/detail'),
            name: 'pm2Edit',
            hidden: true,
            meta: { title: '自主维护详情', activeMenu: '/workOrder/pm2', roles: ['WorkOrderPm2Detail'], i18: 'workorder.detail' }
          },
          {
            path: '/workOrder/pm3',
            component: () => import('@/views/workOrderPage/pm3'),
            name: 'pm3',
            meta: { title: '专业维护', activeMenu: '/workOrder/pm3', roles: ['WorkOrderPm3'], i18: 'workorder.pm.plan3.list' }
          },
          {
            path: '/workOrder/pm3/add',
            component: () => import('@/views/workOrderPage/pm3/detail'),
            name: 'pm3Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/workOrder/pm3', roles: ['WorkOrderPm3Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm3/edit/:id',
            component: () => import('@/views/workOrderPage/pm3/detail'),
            name: 'pm3Edit',
            hidden: true,
            meta: { title: '专业维护详情', activeMenu: '/workOrder/pm3', roles: ['WorkOrderPm3Detail'], i18: 'workorder.detail' }
          },
          {
            path: '/workOrder/pm4',
            component: () => import('@/views/workOrderPage/pm4'),
            name: 'pm4',
            meta: { title: '加油润滑', activeMenu: '/workOrder/pm4', roles: ['WorkOrderPm4'], i18: 'workorder.pm.plan4.list' }
          },
          {
            path: '/workOrder/pm4/add',
            component: () => import('@/views/workOrderPage/pm4/detail'),
            name: 'pm4Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/workOrder/pm4', roles: ['WorkOrderPm4Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm4/edit/:id',
            component: () => import('@/views/workOrderPage/pm4/detail'),
            name: 'pm4Edit',
            hidden: true,
            meta: { title: '加油润滑详情', activeMenu: '/workOrder/pm4', roles: ['WorkOrderPm4Detail'], i18: 'workorder.detail' }
          },
          {
            path: '/workOrder/pm5',
            component: () => import('@/views/workOrderPage/pm5'),
            name: 'pm5',
            meta: { title: '专业点检', activeMenu: '/workOrder/pm5', roles: ['WorkOrderPm5'], i18: 'workorder.pm.plan5.list' }
          },
          {
            path: '/workOrder/pm5/add',
            component: () => import('@/views/workOrderPage/pm5/detail'),
            name: 'pm5Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/workOrder/pm5', roles: ['WorkOrderPm5Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm5/edit/:id',
            component: () => import('@/views/workOrderPage/pm5/detail'),
            name: 'pm5Edit',
            hidden: true,
            meta: { title: '专业点检详情', activeMenu: '/workOrder/pm5', roles: ['WorkOrderPm5Detail'], i18: 'workorder.detail' }
          },
          {
            path: '/workOrder/pm6',
            component: () => import('@/views/workOrderPage/pm6'),
            name: 'pm6',
            meta: { title: '专业巡检', activeMenu: '/workOrder/pm6', roles: ['WorkOrderPm6'], i18: 'workorder.pm.plan6.list' }
          },
          {
            path: '/workOrder/pm6/add',
            component: () => import('@/views/workOrderPage/pm6/detail'),
            name: 'pm6Add',
            hidden: true,
            meta: { title: '自主点检新增', activeMenu: '/workOrder/pm6', roles: ['WorkOrderPm6Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm6/edit/:id',
            component: () => import('@/views/workOrderPage/pm6/detail'),
            name: 'pm6Edit',
            hidden: true,
            meta: { title: '专业巡检详情', activeMenu: '/workOrder/pm6', roles: ['WorkOrderPm5Detail'], i18: 'workorder.detail' }
          },
          {
            path: '/workOrder/pm9',
            component: () => import('@/views/workOrderPage/pm9'),
            name: 'pm9',
            meta: { title: '计划维修', activeMenu: '/workOrder/pm9', roles: ['WorkOrderPm9'], i18: 'workorder.pm.plan7.list' }
          },
          {
            path: '/workOrder/pm9/add',
            component: () => import('@/views/workOrderPage/pm9/detail'),
            name: 'pm9Add',
            hidden: true,
            meta: { title: '计划维修新增', activeMenu: '/workOrder/pm9', roles: ['WorkOrderPm9Add'], i18: 'workorder.add' }
          },
          {
            path: '/workOrder/pm9/edit/:id',
            component: () => import('@/views/workOrderPage/pm9/detail'),
            name: 'pm9Edit',
            hidden: true,
            meta: { title: '计划维修详情', activeMenu: '/workOrder/pm9', roles: ['WorkOrderPm9Detail'], i18: 'workorder.detail' }
          }
        ]
      },
      {
        path: '/workorder/cm',
        component: () => import('@/views/workOrderPage/cm/index'),
        name: 'cm',
        meta: { title: '报修工单', noCache: true, roles: ['WorkOrderCm'], i18: 'workorder.cm.name' }
      },
      {
        path: '/workorder/cm/add',
        component: () => import('@/views/workOrderPage/cm/detail'),
        name: 'cmAdd',
        hidden: true,
        meta: { title: '故障维修新增', activeMenu: '/workorder/cm', roles: ['WorkOrderCmAdd'] }
      },
      {
        path: '/workorder/cm/edit/:id',
        component: () => import('@/views/workOrderPage/cm/detail'),
        hidden: true,
        name: 'cmEdit',
        meta: { title: '故障维修详情', activeMenu: '/workorder/cm', roles: ['WorkOrderCmDetail'] }
      }
    ]
  },
  {
    path: '/personnel',
    component: Layout,
    redirect: 'noRedirect',
    alwaysShow: true,
    name: 'personnel',
    meta: {
      title: '人员管理',
      icon: 'renyuan',
      roles: ['Personnel'],
      i18: 'personnel.name'
    },
    children: [
      {
        path: '/personnel/staff',
        component: () => import('@/views/personnelPage/admin/index'),
        name: 'staff',
        meta: { title: '人员管理', noCache: true, roles: ['PersonnelStaff'], i18: '人员管理' }
      },
      {
        path: '/personnel/staff/add',
        component: () => import('@/views/personnelPage/admin/detail'),
        name: 'staffAdd',
        hidden: true,
        meta: { title: '人员新增', activeMenu: '/personnel/staff', roles: ['PersonnelStaffAdd'], i18: 'personnel.staff.create' }
      },
      {
        path: '/personnel/staff/edit/:id',
        component: () => import('@/views/personnelPage/admin/detail'),
        hidden: true,
        name: 'staffEdit',
        meta: { title: '人员详情', activeMenu: '/personnel/staff', roles: ['PersonnelStaffDetail'], i18: 'personnel.staff.edit' }
      },
      {
        path: '/personnel/department',
        component: () => import('@/views/personnelPage/department/index'),
        name: 'department',
        hidden: true,
        meta: { title: '部门管理', noCache: true, roles: ['PersonnelDepartment'], i18: 'personnel.department.name' }
      },
      {
        path: '/personnel/department/add',
        component: () => import('@/views/personnelPage/department/detail'),
        name: 'departmentAdd',
        hidden: true,
        meta: { title: '部门管理新增', activeMenu: '/personnel/department', roles: ['PersonnelDepartmentAdd'], i18: 'personnel.department.create' }
      },
      {
        path: '/personnel/department/edit/:id',
        component: () => import('@/views/personnelPage/department/detail'),
        hidden: true,
        name: 'departmentEdit',
        meta: { title: '部门管理详情', activeMenu: '/personnel/department', roles: ['PersonnelDepartmentDetail'], i18: 'personnel.department.edit' }
      }
    ]
  },
  {
    path: '/knowledge',
    component: Layout,
    redirect: 'noRedirect',
    name: 'knowledge',
    alwaysShow: true,
    meta: {
      title: '知识管理',
      icon: 'zhishi',
      roles: ['Knowledge'],
      i18: 'knowledge.name'
    },
    children: [
      {
        path: '/knowledge/category',
        component: () => import('@/views/knowledgePage/category/index'),
        name: 'category',
        meta: { title: '知识分类', noCache: true, roles: ['KnowledgeCategory'], i18: 'knowledge.category.name' }
      },
      {
        path: '/knowledge/category/add',
        component: () => import('@/views/knowledgePage/category/detail'),
        name: 'categoryAdd',
        hidden: true,
        meta: { title: '知识分类新增', activeMenu: '/knowledge/category', roles: ['KnowledgeCategoryAdd'], i18: 'knowledge.category.create' }
      },
      {
        path: '/knowledge/category/edit/:id',
        component: () => import('@/views/knowledgePage/category/detail'),
        hidden: true,
        name: 'categoryEdit',
        meta: { title: '知识分类详情', activeMenu: '/knowledge/category', roles: ['KnowledgeCategoryDetail'], i18: 'knowledge.category.edit' }
      },
      {
        path: '/knowledge/knowledge',
        component: () => import('@/views/knowledgePage/knowledge/index'),
        name: 'knowledges',
        meta: { title: '知识管理', noCache: true, roles: ['KnowledgeKnowledge'], i18: 'knowledge.knowledge.name' }
      },
      {
        path: '/knowledge/knowledge/add',
        component: () => import('@/views/knowledgePage/knowledge/detail'),
        name: 'knowledgeAdd',
        hidden: true,
        meta: { title: '知识管理新增', activeMenu: '/knowledge/knowledge', roles: ['KnowledgeKnowledgeAdd'], i18: 'knowledge.knowledge.create' }
      },
      {
        path: '/knowledge/knowledge/edit/:id',
        component: () => import('@/views/knowledgePage/knowledge/detail'),
        hidden: true,
        name: 'knowledgeEdit',
        meta: { title: '知识管理详情', activeMenu: '/knowledge/knowledge', roles: ['KnowledgeKnowledgeDetail'], i18: 'knowledge.knowledge.detail' }
      }
    ]
  },
  {
    path: '/system',
    component: Layout,
    redirect: 'noRedirect',
    name: 'systems',
    alwaysShow: true,
    meta: {
      title: '系统管理',
      icon: 'xitong',
      roles: ['System'],
      i18: 'system.name'
    },
    children: [
      {
        path: '/system/cost',
        component: () => import('@/views/systemPage/cost/index'),
        name: 'cost',
        meta: { title: '成本中心', noCache: true, roles: ['SystemCost'], i18: 'system.cost.name' }
      },
      {
        path: '/system/cost/add',
        component: () => import('@/views/systemPage/cost/detail'),
        name: 'costAdd',
        hidden: true,
        meta: { title: '成本中心新增', activeMenu: '/system/cost', roles: ['SystemCostAdd'], i18: 'system.cost.create' }
      },
      {
        path: '/system/cost/edit/:id',
        component: () => import('@/views/systemPage/cost/detail'),
        hidden: true,
        name: 'costEdit',
        meta: { title: '成本中心详情', activeMenu: '/system/cost', roles: ['SystemCostDetail'], i18: 'system.cost.edit' }
      },
      {
        path: '/system/errorCode',
        component: () => import('@/views/systemPage/errorCode/index'),
        name: 'errorCode',
        meta: { title: '错误代码', noCache: true, roles: ['SystemErrorCode'], i18: 'system.errorCode.name' }
      },
      {
        path: '/system/errorCode/add',
        component: () => import('@/views/systemPage/errorCode/detail'),
        name: 'errorCodeAdd',
        hidden: true,
        meta: { title: '错误代码新增', activeMenu: '/system/errorCode', roles: ['SystemErrorCodeAdd'], i18: 'system.errorCode.create' }
      },
      {
        path: '/system/errorCode/edit/:id',
        component: () => import('@/views/systemPage/errorCode/detail'),
        hidden: true,
        name: 'errorCodeEdit',
        meta: { title: '错误代码详情', activeMenu: '/system/errorCode', roles: ['SystemErrorCodeDetail'], i18: 'system.errorCode.edit' }
      },
      {
        path: '/system/provider',
        component: () => import('@/views/systemPage/provider/index'),
        name: 'provider',
        meta: { title: '供应商', noCache: true, roles: ['SystemProvider'], i18: 'system.provider.name' }
      },
      {
        path: '/system/provider/add',
        component: () => import('@/views/systemPage/provider/detail'),
        name: 'providerAdd',
        hidden: true,
        meta: { title: '供应商新增', activeMenu: '/system/provider', roles: ['SystemProviderAdd'], i18: 'system.provider.create' }
      },
      {
        path: '/system/provider/edit/:id',
        component: () => import('@/views/systemPage/provider/detail'),
        hidden: true,
        name: 'providerEdit',
        meta: { title: '供应商详情', activeMenu: '/system/provider', roles: ['SystemProviderDetail'], i18: 'system.provider.edit' }
      },
      {
        path: '/system/store',
        component: () => import('@/views/systemPage/store/index'),
        name: 'store',
        meta: { title: '仓库管理', noCache: true, roles: ['SystemStore'], i18: 'system.store.name' }
      },
      {
        path: '/system/store/add',
        component: () => import('@/views/systemPage/store/detail'),
        name: 'storeAdd',
        hidden: true,
        meta: { title: '仓库管理增', activeMenu: '/system/store', roles: ['SystemStoreAdd'], i18: 'system.store.create' }
      },
      {
        path: '/system/store/edit/:id',
        component: () => import('@/views/systemPage/store/detail'),
        hidden: true,
        name: 'storeEdit',
        meta: { title: '仓库管理详情', activeMenu: '/system/store', roles: ['SystemStoreDetail'], i18: 'system.store.edit' }
      },
      {
        path: '/system/factory',
        component: () => import('@/views/systemPage/factory/index'),
        name: 'factory',
        hidden: true,
        meta: { title: '工厂管理', noCache: true, roles: ['SystemFactory'], i18: 'system.factory.name' }
      },
      {
        path: '/system/factory/add',
        component: () => import('@/views/systemPage/factory/detail'),
        name: 'factoryAdd',
        hidden: true,
        meta: { title: '工厂管理新增', activeMenu: '/system/factory', roles: ['SystemFactoryAdd'], i18: 'system.factory.create' }
      },
      {
        path: '/system/factory/edit/:id',
        component: () => import('@/views/systemPage/factory/detail'),
        hidden: true,
        name: 'factoryEdit',
        meta: { title: '工厂管理详情', activeMenu: '/system/factory', roles: ['SystemFactoryDetail'], i18: 'system.factory.edit' }
      },
      {
        path: '/system/message',
        component: () => import('@/views/systemPage/message/index'),
        name: 'message',
        hidden: true,
        meta: { title: '消息', noCache: true }
      }
    ]
  },
  {
    path: '/charts',
    component: Layout,
    redirect: 'noRedirect',
    name: 'charts',
    alwaysShow: true,
    meta: {
      title: '报表管理',
      icon: 'chart',
      roles: ['Charts'],
      i18: 'report.name'
    },
    children: [
      {
        path: '/charts/asset',
        component: () => import('@/views/chartsPage/asset/index'),
        name: 'chartsAsset',
        meta: { title: '资产报表', noCache: true, roles: ['ChartsAsset'], i18: 'report.asset.name' }
      },
      {
        path: '/charts/maintain',
        component: () => import('@/views/chartsPage/maintain/index'),
        name: 'maintain',
        meta: { title: '保全报表', noCache: true, roles: ['ChartsMaintain'], i18: 'report.maintain.name' }
      },
      {
        path: '/charts/targetChart',
        component: () => import('@/views/chartsPage/targetChart/index'),
        name: 'targetChart',
        hidden: true,
        meta: { title: '指标报表', noCache: true, roles: ['ChartsTarget'], i18: 'report.target.name' }
      },
      {
        path: '/charts/targetCategory',
        component: () => import('@/views/chartsPage/targetCategory/index'),
        name: 'targetCategory',
        hidden: false,
        meta: { title: '指标分类', noCache: true, roles: ['Charts'], i18: '指标分类' }
      },
      {
        path: '/charts/targetCategory/add',
        component: () => import('@/views/chartsPage/targetCategory/detail'),
        name: 'targetCategoryAdd',
        hidden: true,
        meta: { title: '新增分类', activeMenu: '/charts/targetCategory', roles: ['Charts'], i18: '新增分类' }
      },
      {
        path: '/charts/targetCategory/edit/:id',
        component: () => import('@/views/chartsPage/targetCategory/detail'),
        hidden: true,
        name: 'targetCategoryEdit',
        meta: { title: '更新分类', activeMenu: '/charts/targetCategory', roles: ['Charts'], i18: '更新分类' }
      },
      {
        path: '/charts/target',
        component: () => import('@/views/chartsPage/target/index'),
        name: 'target',
        hidden: false,
        meta: { title: '指标', noCache: true, roles: ['Charts'], i18: '指标' }
      },
      {
        path: '/charts/target/add',
        component: () => import('@/views/chartsPage/target/detail'),
        name: 'targetAdd',
        hidden: true,
        meta: { title: '新增指标', activeMenu: '/charts/target', roles: ['Charts'], i18: '新增指标' }
      },
      {
        path: '/charts/target/edit/:id',
        component: () => import('@/views/chartsPage/target/detail'),
        hidden: true,
        name: 'targetEdit',
        meta: { title: '更新指标', activeMenu: '/charts/target', roles: ['Charts'], i18: '更新指标' }
      },
      {
        path: '/charts/record',
        component: () => import('@/views/chartsPage/record/index'),
        name: 'record',
        hidden: false,
        meta: { title: '记录', noCache: true, roles: ['Charts'], i18: '记录' }
      },
      {
        path: '/charts/record/add',
        component: () => import('@/views/chartsPage/record/detail'),
        name: 'recordAdd',
        hidden: true,
        meta: { title: '新增记录', activeMenu: '/charts/record', roles: ['Charts'], i18: '新增记录' }
      },
      {
        path: '/charts/record/edit/:id',
        component: () => import('@/views/chartsPage/record/detail'),
        hidden: true,
        name: 'recordEdit',
        meta: { title: '更新记录', activeMenu: '/charts/record', roles: ['Charts'], i18: '更新记录' }
      },
      {
        path: '/charts/energyCategory',
        component: () => import('@/views/chartsPage/energyCategory/index'),
        name: 'energyCategory',
        hidden: false,
        meta: { title: '能源指标分类', noCache: true, roles: ['Charts'], i18: '能源指标分类' }
      },
      {
        path: '/charts/energyCategory/add',
        component: () => import('@/views/chartsPage/energyCategory/detail'),
        name: 'energyCategoryAdd',
        hidden: true,
        meta: { title: '新增分类', activeMenu: '/charts/energyCategory', roles: ['Charts'], i18: '新增分类' }
      },
      {
        path: '/charts/energyCategory/edit/:id',
        component: () => import('@/views/chartsPage/energyCategory/detail'),
        hidden: true,
        name: 'energyCategoryEdit',
        meta: { title: '更新分类', activeMenu: '/charts/energyCategory', roles: ['Charts'], i18: '更新分类' }
      },
      {
        path: '/charts/energyTarget',
        component: () => import('@/views/chartsPage/energyTarget/index'),
        name: 'energyTarget',
        hidden: false,
        meta: { title: '能源指标', noCache: true, roles: ['Charts'], i18: '能源指标' }
      },
      {
        path: '/charts/energyTarget/add',
        component: () => import('@/views/chartsPage/energyTarget/detail'),
        name: 'energyTargetAdd',
        hidden: true,
        meta: { title: '新增指标', activeMenu: '/charts/energyTarget', roles: ['Charts'], i18: '新增指标' }
      },
      {
        path: '/charts/energyTarget/edit/:id',
        component: () => import('@/views/chartsPage/energyTarget/detail'),
        hidden: true,
        name: 'energyTargetEdit',
        meta: { title: '更新指标', activeMenu: '/charts/energyTarget', roles: ['Charts'], i18: '更新指标' }
      },
      {
        path: '/charts/energyRecord',
        component: () => import('@/views/chartsPage/energyRecord/index'),
        name: 'energyRecord',
        hidden: false,
        meta: { title: '能源记录', noCache: true, roles: ['Charts'], i18: '能源记录' }
      },
      {
        path: '/charts/energyRecord/add',
        component: () => import('@/views/chartsPage/energyRecord/detail'),
        name: 'energyRecordAdd',
        hidden: true,
        meta: { title: '新增记录', activeMenu: '/charts/energyRecord', roles: ['Charts'], i18: '新增记录' }
      },
      {
        path: '/charts/energyRecord/edit/:id',
        component: () => import('@/views/chartsPage/energyRecord/detail'),
        hidden: true,
        name: 'energyRecordEdit',
        meta: { title: '更新记录', activeMenu: '/charts/energyRecord', roles: ['Charts'], i18: '更新记录' }
      },
      {
        path: '/charts/energyQuota',
        component: () => import('@/views/chartsPage/energyQuota/index'),
        name: 'energyQuota',
        hidden: false,
        meta: { title: '能源日定额', noCache: true, roles: ['Charts'], i18: '能源日定额' }
      },
      {
        path: '/charts/energyQuota/add',
        component: () => import('@/views/chartsPage/energyQuota/detail'),
        name: 'energyQuotaAdd',
        hidden: true,
        meta: { title: '新增能源日定额', activeMenu: '/charts/energyQuota', roles: ['Charts'], i18: '新增能源日定额' }
      },
      {
        path: '/charts/energyQuota/edit/:id',
        component: () => import('@/views/chartsPage/energyQuota/detail'),
        hidden: true,
        name: 'energyQuotaEdit',
        meta: { title: '更新能源日定额', activeMenu: '/charts/energyQuota', roles: ['Charts'], i18: '更新能源日定额' }
      }
    ]
  },
  {
    path: '/role',
    component: Layout,
    redirect: 'noRedirect',
    name: 'roles',
    alwaysShow: true,
    meta: {
      title: '权限管理',
      icon: 'el-icon-lock',
      roles: ['Role'],
      i18: 'access.name'
    },
    children: [
      {
        path: '/role/role',
        component: () => import('@/views/rolePage/role/index'),
        name: 'role',
        meta: { title: '角色管理', noCache: true, roles: ['RoleRole'], i18: 'access.role.name' }
      },
      {
        path: '/role/role/add',
        component: () => import('@/views/rolePage/role/detail'),
        name: 'roleAdd',
        hidden: true,
        meta: { title: '角色管理新增', activeMenu: '/role/role', roles: ['RoleRoleAdd'], i18: 'access.role.create' }
      },
      {
        path: '/role/role/edit/:id',
        component: () => import('@/views/rolePage/role/detail'),
        hidden: true,
        name: 'roleEdit',
        meta: { title: '角色详情', activeMenu: '/role/role', roles: ['RoleRoleDetail'], i18: 'access.role.edit' }
      },
      {
        path: '/role/access',
        component: () => import('@/views/rolePage/access/index'),
        name: 'access',
        meta: { title: '权限管理', noCache: true, roles: ['RoleAccess'], i18: 'access.access.name' }
      },
      {
        path: '/role/access/add',
        component: () => import('@/views/rolePage/access/detail'),
        name: 'accessAdd',
        hidden: true,
        meta: { title: '权限管理新增', activeMenu: '/role/access', roles: ['RoleAccessAdd'], i18: 'access.access.create' }
      },
      {
        path: '/role/access/edit/:id',
        component: () => import('@/views/rolePage/access/detail'),
        hidden: true,
        name: 'accessEdit',
        meta: { title: '权限管理详情', activeMenu: '/role/access', roles: ['RoleAccessDetail'], i18: 'access.access.edit' }
      }
    ]
  },
  // {
  //   path: '/engineers',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'engineers',
  //   meta: {
  //     title: 'Energy',
  //     icon: 'zichan'
  //   },
  //   children: [
  //     {
  //       path: 'engineer',
  //       component: () => import('@/views/engineerCharts/index'),
  //       name: 'engineer',
  //       meta: { title: '工程师报表', noCache: true, i18: '工程师报表' }
  //     },
  //     {
  //       path: 'engineerFull',
  //       component: () => import('@/views/engineerCharts/detail.vue'),
  //       name: 'engineerFull',
  //       hidden: true,
  //       meta: { title: '工程师报表', noCache: true, i18: '工程师报表' }
  //     }
  //   ]
  // },
  // {
  //   path: '/newCharts',
  //   component: Layout,
  //   redirect: 'noRedirect',
  //   name: 'newCharts',
  //   meta: {
  //     title: 'Energy',
  //     icon: 'zichan'
  //   },
  //   children: [
  //     {
  //       path: 'indexCharts',
  //       component: () => import('@/views/engineerCharts/indexCharts.vue'),
  //       name: 'indexCharts',
  //       meta: { title: '驾驶舱报表', noCache: true, i18: '驾驶舱报表' }
  //     },
  //     {
  //       path: 'indexFull',
  //       component: () => import('@/views/engineerCharts/indexChartsFull.vue'),
  //       name: 'indexFull',
  //       hidden: true,
  //       meta: { title: '驾驶舱报表详情', noCache: true, i18: '驾驶舱报表' }
  //     }
  //   ]
  // },
  { path: '*', redirect: '/404', hidden: true }

  // 404 page must be placed at the end !!!
]

const createRouter = () => new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes
})

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
